package cn.smxy.pojo;

import cn.smxy.constant.UserConstant;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

@Data
@TableName("user")
public class User implements Serializable {
    private static final long serialVersionUID = -7934825302014513167L;

    @TableId(type = IdType.ASSIGN_ID,value = "user_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @ExcelProperty("名称")
    private String userName;

    private String userPhoto;

    @NotBlank
    @Length(min = 6)
    @ExcelProperty("账号")
    private String userAccount;

    @NotBlank
    @Length(min = 6)
    @ExcelProperty("密码")
    private String userPassword;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long collegeId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @ExcelProperty("邮箱")
    private String email;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @ExcelProperty("手机号")
    private String userPhone;

    private Integer userRole;

    private Long createTime;
}
